home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / gcc / gcc261c.zoo / objects / Array.h next >
Encoding:
C/C++ Source or Header  |  1994-11-18  |  2.2 KB  |  66 lines

  1. /* Interface for Objective-C Array collection object
  2.    Copyright (C) 1993,1994 Free Software Foundation, Inc.
  3.  
  4.    Written by:  R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
  5.    Date: May 1993
  6.  
  7.    This file is part of the GNU Objective C Class Library.
  8.  
  9.    This library is free software; you can redistribute it and/or
  10.    modify it under the terms of the GNU Library General Public
  11.    License as published by the Free Software Foundation; either
  12.    version 2 of the License, or (at your option) any later version.
  13.    
  14.    This library is distributed in the hope that it will be useful,
  15.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  17.    Library General Public License for more details.
  18.  
  19.    You should have received a copy of the GNU Library General Public
  20.    License along with this library; if not, write to the Free
  21.    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  22. */ 
  23.  
  24. #ifndef __Array_h_INCLUDE_GNU
  25. #define __Array_h_INCLUDE_GNU
  26.  
  27. #include <objects/stdobjects.h>
  28. #include <objects/IndexedCollection.h>
  29.  
  30. @interface Array : IndexedCollection
  31. {
  32.   @public
  33.   int (*_comparison_function)(elt,elt);
  34.   elt *_contents_array;
  35.   unsigned int _count;
  36.   unsigned int _capacity;
  37.   unsigned int _grow_factor;
  38. }
  39.  
  40. + (unsigned) defaultCapacity;
  41. + (unsigned) defaultGrowFactor;
  42.  
  43. - initWithType: (const char *)contentEncoding
  44.     capacity: (unsigned)aCapacity;
  45. - initWithCapacity: (unsigned) aCapacity;
  46.  
  47. - setCapacity: (unsigned)newCapacity;
  48. - (unsigned) growFactor;
  49. - setGrowFactor: (unsigned)aNum;
  50.  
  51. @end
  52.  
  53. #define FOR_ARRAY(ARRAY, ELEMENT_VAR)                                  \
  54. {                                                                      \
  55.   unsigned _FOR_ARRAY_i;                                               \
  56.   for (_FOR_ARRAY_i = 0;                                               \
  57.        _FOR_ARRAY_i < ((Array*)ARRAY)->_count;                         \
  58.        _FOR_ARRAY_i++)                                                 \
  59.     {                                                                  \
  60.       ELEMENT_VAR =                                                    \
  61.     (((Array*)ARRAY)->_contents_array[_FOR_ARRAY_i]);
  62.  
  63. #define FOR_ARRAY_END }}
  64.  
  65. #endif /* __Array_h_INCLUDE_GNU */
  66.